package top.lilele.adminSystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * @author lilele
 */
@Getter
@Setter
@TableName(value = "admin_resource")
public class AdminResourceEntity implements Serializable {
    /**
     * id
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 资源标识
     */
    @TableField(value = "name")
    @Length(max = 100, message = "资源标识限制100个字符")
    @NotEmpty(message = "资源标识不能为空")
    private String name;

    /**
     * 资源名称
     */
    @Length(max = 30, message = "资源名称限制30个字符")
    @TableField(value = "label")
    private String label;

    /**
     * 资源描述
     */
    @Length(max = 100, message = "资源描述限制100个字符")
    @TableField(value = "description")
    private String description;

    /**
     * 资源url
     */
    @TableField(value = "url")
    @Length(max = 100, message = "资源路径限制100个字符")
    @NotEmpty(message = "资源路径不能为空")
    private String url;


    /**
     * 资源图标
     */
    @TableField(value = "ico")
    @Length(max = 100, message = "资源图标限制100个字符")
    private String ico;

    /**
     * 父菜单id
     */
    @TableField(value = "parentId")
    private String parentId;

    /**
     * 资源类型 0 菜单 1 api 2 外链
     */
    @NotNull(message = "资源类型不能为空")
    @TableField(value = "menuType")
    private Integer menuType;

    /**
     * 排序
     */
    @TableField(value = "sort")
    private Integer sort;

    /**
     * 资源是否可用
     */
    @TableField(value = "available")
    private Integer available;

    @TableField(exist = false)
    private List<AdminResourceEntity> children;

    @TableField(value = "createdTime", fill = FieldFill.INSERT)
    private Date createdTime;
    @TableField(value = "updatedTime", fill = FieldFill.UPDATE)
    private Date updatedTime;
}
